$(function(){
	var newBtn=$(".newBtn");
	var newsList=$(".newsList");
	
	newBtn.each(function(index){
		$(this).click(function(){
			newBtn.removeClass("on");
			$(this).addClass("on");
			newsList.hide();
			newsList.eq(index).show();
		})
	});
	var showCaseBox=$(".showCaseBox");
	var dt;
	return;
	num=0;
	dt=setInterval(function(){
		num++;
		if(num>500){
		num=0;	
		showCaseBox.css("margin-left",0);
		}
	showCaseBox.css("margin-left",-num);	
	},40);
	showCaseBox.mouseover(function(){
		clearInterval(dt);
	});
	showCaseBox.mouseout(function(){
	dt=setInterval(function(){
		num++;
		if(num>500){
		num=0;	
		showCaseBox.css("margin-left",0);
		}
	showCaseBox.css("margin-left",-num);	
	},40);	
	});
//
	
})
//新闻搜索
function searchBtn(){
	var span=$('.newBtn');
	var classify=1;
	$.each(span,function(index) {
		if($(this).hasClass('on')){
			if($(this).text()=="华美新闻"){
				classify=1;
			}else if($(this).text()=="行业热点"){
				classify=2;
			}else if($(this).text()=="最新政策"){
				classify=3;
			}
		}
	})
	$.post('newsSearch.do',{classify:classify, searchInfo:$('#searchInfo').val()},function(result){
		if(result.state == 0){
			$('#newsUL'+classify).html('');
			var newsList = result.data;
			for (var i = 0; i < 6; i++) {
				var li = '<li class="newsListBox clearfixs">' +
						 '<div class="leftBox">' +
							'<img src="'+ newsList[i].photo +'" />' +
						 '</div>' +
						 '<div class="rightBox">' +
						 '<div>' +
						 	'<h2 class="clearfixs">' +
						 		'<a class="newTit" href="detailNews.htm?id='+ newsList[i].id +'">'+newsList[i].title+'</a>' +
						 		'<span class="newTimer">'+ newsList[i].updateTime +'</span>' +
						 	'</h2>' +
						 '</div>' +
						 '<p class="newsCont">'+ newsList[i].detail +'</p>' +
						 '</div>' +
						 '</li>';
				 $('#newsUL'+classify).append(li);
			}
		}else{
			alert(result.message);
		}
	})
}
var formatDateTime = function (date) {  
    var y = date.getFullYear();  
    var m = date.getMonth() + 1;  
    m = m < 10 ? ('0' + m) : m;  
    var d = date.getDate();  
    d = d < 10 ? ('0' + d) : d;  
    var h = date.getHours();  
    var minute = date.getMinutes();  
    minute = minute < 10 ? ('0' + minute) : minute;  
    return y + '-' + m + '-' + d+' '+h+':'+minute;  
};  //返回值：yyyy-MM-dd HH:mm